package com.bluesky.light.healthnews;

import java.util.ArrayList;
import java.util.List;

/**
 * 把健康新聞緩存到內存
 * 
 * @author
 * 
 */
public class HealthNewsRamDAO {

	/**
	 * 一個存放健康新聞的容器
	 */
	private static List<HealthNews> newses = null;

	/**
	 * @return
	 */
	public List<HealthNews> getNewses() {
		return newses;
	}

	/**
	 * 
	 */
	public void delete() {
		newses.clear();
	}

	/**
	 * @param news
	 */
	public void add(HealthNews news) {
		newses.add(news);
	}

	/**
	 * @return
	 */
	public HealthNews getLastNews() {
		if (newses == null)
			newses = new ArrayList<HealthNews>();
		return (newses.size() == 0) ? null : newses.get(newses.size() - 1);
	}

}
